package com.example.boot.acutuator.endpoint;

import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.annotation.WriteOperation;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.Map;

/**
 * 自定义端点,自定义端点不用设置暴露
 * @author shkstart
 * @creat 2021-04-07-下午10:41
 */
//标识端点名，比如和info、beans、health等
@Endpoint(id="myswevice")
@Component
public class MyServiceEndPoint {

    @ReadOperation
    public Map getDockerInfo(){
        //端点的读操作
        return Collections.singletonMap("dockerInfo","docker stared....");
    }
    @WriteOperation
    public void stopDocker(){
        System.out.println("docker stopped...");
    }
}
